package com.agency8x.model.base;

import java.util.HashMap;
import java.util.Map;

import com.jfinal.plugin.activerecord.IBean;

public class TableInfo implements IBean {

	private String tableName;
	private Map<String,ColumnInfo> columns;
	public TableInfo(){
		columns=new HashMap<String,ColumnInfo>();
	}
	public void setTableName(String table){
		this.tableName=table;
	}
	public String getTableName(){
return this.tableName;
	}
	public void setColInfo(String columnName,ColumnInfo col){
		columns.put(columnName, col);
		
	}
	public ColumnInfo getColumnInfo(String columnName){
		return columns.getOrDefault(columnName, null);
	}
	public void setPrimaryKey(String columnName,boolean isKey){
		ColumnInfo col=columns.getOrDefault(columnName, null);
		if(null!=col){
			col.setKey(isKey);
		}
	}
}
